"""
class Ticket:
    pirce = 100
    def weekends(self, adult_num, kids_num):
        pirce_adult = self.pirce *1.2
        pirce_kids = pirce_adult * 0.5
        total = (adult_num * pirce_adult) + (kids_num * pirce_kids)
        print("在周末%d个成人和%d个孩子一共是%d元"%(adult_num, kids_num, total))
    def usually(self, adult_num, kids_num):
        pirce_adult = self.pirce
        pirce_kids = pirce_adult * 0.5
        total = (adult_num * pirce_adult) + (kids_num * pirce_kids)
        print("在平常%d个成人和%d个孩子一共是%d元"%(adult_num, kids_num, total))

p = Ticket()
p.usually(2,1)
p.weekends(2,1)
"""
class Ticket():
        def __init__(self, weekend=False, child=False):
                self.exp = 100     #相当于初始化票价100 ，在此基础上修改儿童和周末的票价！
                if weekend:
                        self.inc = 1.2
                else:
                        self.inc = 1
                if child:
                        self.discount = 0.5
                else:
                        self.discount = 1
        def calcPrice(self, num):
                return self.exp * self.inc * self.discount * num

adult = Ticket()
child = Ticket(child=True)
print("2个成人 + 1个小孩平日票价为：%.2f" % (adult.calcPrice(2) + child.calcPrice(1)))

        
        
        

